import time

from common.exchanges import DeribitPriService
from common.helper import init_log


from common.exchanges.binance import BinanceAccountType, BinanceUserDataCatcher
from common.exchanges.entities import ApiAuthInfo

init_log()

API_KEY = '986b55aabc495d619ea3713825a93cb63d49f8e0231c44db41ddabe6aa7bb590'
API_SECRET = 'f38d259ff324ac9852e57a848318cf310758fa97fd923f25d072830de237e378'

auth_info = ApiAuthInfo(api_key=API_KEY, api_secret=API_SECRET)

DeribitPriService.install_broker_info(
    'XShTrBsx', 'uEfzWfQ70tR9o3_uy6bKbgMHpbpkJiCnUL3PYrCNXkU'
)


if __name__ == '__main__':
    catcher = BinanceUserDataCatcher(auth_info, BinanceAccountType.C_Future, 'test', )
    catcher.run()

    for _ in range(1000):
        time.sleep(5)
        summaries = catcher.account_summaries()
        positions = catcher.positions()
        open_orders = catcher.open_orders()

        print(f'summaries is {summaries}')
        print(f'positions is {positions}')
        print(f'open_orders is {open_orders}')
